<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:a4j="http://richfaces.org/a4j">
    <f:view>   
        <h:head>
            <title>Pref game club</title>
            <link href="mycss.css" rel="stylesheet" type="text/css"/>
        </h:head>
        <h:body>
            <h:outputLabel value="#{hall.msg}" />
            <h:panelGrid id="PlayerData" columns="4">
                <h:outputLabel value="#{msg.playerName}"/>
                <h:outputLabel value="#{hallController.player.name}"/>
                <h:outputLabel value="#{msg.playerUID}"/>
                <h:outputLabel value="#{hallController.player.UID}"/>                
            </h:panelGrid>
            <a4j:poll id="pollCreatedGames" interval="2000" render="CreatedGames" enabled="true" />
            <h:panelGrid id="CreatedGames" columns="4">
                <h:dataTable value="#{hall.createdGames}" var="CreatedGame"
                             styleClass="rows"
                             headerClass="rowsHeader"
                             columnClasses="rowsColumn">

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="npp" style="font-weight: bold"/>
                        </f:facet>
                        <h:outputText value="#{hall.createdGames.indexOf(CreatedGame)}"/>
                        <f:facet name="footer">
                            <h:outputText value="Sum" style="font-weight: bold"/>
                        </f:facet>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="UID" style="font-weight: bold"/>
                        </f:facet>
                        <h:outputText value="#{CreatedGame.UID}"/>
                        <f:facet name="footer">
                            <h:outputText value="" style="font-weight: bold"/>
                        </f:facet>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Players" style="font-weight: bold"/>
                        </f:facet>
                        <h:dataTable value="#{CreatedGame.players}" var="Player"
                                     styleClass="rows"
                                     headerClass="rowsHeader"
                                     columnClasses="rowsColumn">
                            <h:column>
                                <h:outputText value="#{Player.name}"/>
                            </h:column>
                        </h:dataTable>
                        <f:facet name="footer">
                            <h:outputText value="" style="font-weight: bold"/>
                        </f:facet>
                    </h:column>
                </h:dataTable>
            </h:panelGrid>
            <a4j:poll id="pollListOfPlayers" interval="5000" render="ListOfPlayers" enabled="true" />
            <h:panelGrid id="ListOfPlayers" columns="4">
                <h:dataTable value="#{hall.players}" var="Player"
                             styleClass="rows"
                             headerClass="rowsHeader"
                             columnClasses="rowsColumn">

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="npp" style="font-weight: bold"/>
                        </f:facet>
                        <h:outputText value="#{hall.players.indexOf(Player)}"/>
                        <f:facet name="footer">
                            <h:outputText value="Sum" style="font-weight: bold"/>
                        </f:facet>
                    </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="name" style="font-weight: bold"/>
                        </f:facet>
                        <h:outputText value="#{Player.name}"/>
                        <f:facet name="footer">
                            <h:outputText value="#{hall.players.size()}" style="font-weight: bold"/>
                        </f:facet>
                    </h:column>
                </h:dataTable>
            </h:panelGrid>

            <h:panelGrid id="GamesInfo" columns="4">
                <h:outputLabel value="#{msg.playerName}" />
                <h:outputLabel value="#{hallController.player.name}" />

                <h:outputLabel value="#{msg.playerUID}" />
                <h:outputLabel value="#{hallController.player.UID}" />
            </h:panelGrid>
            <a4j:poll id="pollChat" interval="1000" render="Chat" enabled="true" />
            <h:panelGrid id="Chat" columns="4">
                <h:outputLabel value="#{msg.chat}" />
                <h:outputText> 
                </h:outputText>
            </h:panelGrid>

            <h:form  styleClass="player" id="hallForm"> 

                <h:commandButton action="#{hallController.CreateGame()}"  value="#{msg.BcreateGame}"/>

            </h:form>



        </h:body>
    </f:view>
</html>
